package configs

import (
	"context"

	"github.com/gogf/gf/v2/frame/g"
)

type DBType string

const (
	DBTypeSqlite DBType = "sqlite"
)

var _tempDbType DBType = "sqlite"

func GetDBType(ctx context.Context) DBType {
	dbTypeVar, err := g.Cfg().Get(ctx, "dbType")
	if err != nil {
		g.Log().Line(true).Error(ctx, "dbType is not set")
		return _tempDbType
	}

	dbType := dbTypeVar.String()
	if dbType != string(DBTypeSqlite) {
		g.Log().Line(true).Error(ctx, "dbType is not valid")
		return _tempDbType
	}

	_tempDbType = DBTypeSqlite

	return DBTypeSqlite
}
